import requests,json

def downloadFileHttp():
    test_item = {
        'zhangpng':'shanghai',#章的名称方传png文件夹下的图片名称
        'KPLX':'31',
        'GGFMC':'购货方名称',
        'GGFSBH':'91320115MA27HYXA46',
        'XHFMC':'上海黄浦区大众养老院',
        'XHFSBH':'91310000767934044Y',
        'FPHM':'24312000000115629364',
        'KPRQ':'2024年04月25日',
        'JSHJ':'800000.00',
        'HJ':'1111111111.00',
        'HJSE':'222222222.00',
        'KPR':'彭清艳',
        'BZ':'''ddddddddddddddddddddddddddddd打撒打撒打撒十大sssssssssssssssd大苏打实打实的''',
        'datas':[
            {
                'ItemName':'*人力资源服务*劳务',
                'SpecMod':'规格型号1',
                'MeaUnits':'单位',
                'Quantity':'2',
                'UnPrice':'200000.00',
                'Amount':'400000.00',
                'TaxRate':'0.06',
                'ComTaxAm':'24000.00'
            },
            {
                'ItemName':'*人力资源服务*劳务',
                'SpecMod':'规格型号2',
                'MeaUnits':'单位',
                'Quantity':'2',
                'UnPrice':'200000.00',
                'Amount':'400000.00',
                'TaxRate':'0.06',
                'ComTaxAm':'24000.00'
            },
        ]
    }
    for i in range(1,91):
        test_item['datas'].append({
            'ItemName':'*人力资源服务*劳务',
            'SpecMod':'规格型号2',
            'MeaUnits':'单',
            'Quantity':'2.00',
            'UnPrice':'200000.00',
            'Amount':'400000.00',
            'TaxRate':'6%',
            'ComTaxAm':'24000.00'
        })
    
    #print(test_item)
    resofd = requests.post(url='http://127.0.0.1:8121/invoiceofd_show/',data=json.dumps(test_item),timeout=60,headers={'Connection':'close'})
    with open('downloadFile.ofd', "wb") as fw:
        fw.write(resofd.content)
    respdf = requests.post(url='http://127.0.0.1:8121/invoicepdf_show/',data=json.dumps(test_item),timeout=60,headers={'Connection':'close'})
    with open('downloadFile.pdf', "wb") as fw:
        fw.write(respdf.content)
   
    
if __name__ == "__main__":
    downloadFileHttp()